xen init script: silently exit status 0 if not running under xen
authorIan Jackson <ian.jackson@citrix.com>
Thu, 7 Feb 2019 15:54:49 +0000 (15:54 +0000)
committerIan Jackson <ian.jackson@citrix.com>
Fri, 22 Feb 2019 14:00:16 +0000 (14:00 +0000)
This script should not complain at all if we are not running under
Xen.  Check this right at the start.

This will enable improvements to the following code, which will no
longer have to deal with the `not running under Xen' case.

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
Acked-by: Hans van Kranenburg <hans@knorrie.org>
debian/xen-utils-common.xen.init

index 4b793d5ac2fb7cc7f6d17073027dd667a413cc3c..da7d361453102341e0bd577c25c8e243dcc22d7d 100644 (file)
@@ -20,6 +20,10 @@ XENSTORED_DIR="/var/run/xenstored"
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 DESC="Xen daemons"
 
+case "$(cat /sys/hypervisor/type 2>/dev/null)" in
+xen)           ;;
+*)     exit 0  ;; # not running under Xen
+esac
 ROOT=$(/usr/lib/xen-common/bin/xen-dir 2>/dev/null)
 if [ $? -ne 0 ]; then
        log_warning_msg "Not running within Xen or no compatible utils"